<?php

namespace App\EventListener;

use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTInvalidEvent;

class JWTInvalidListener {

    /**
     * @param JWTInvalidEvent $event
     */
    public function onJWTInvalid (JWTInvalidEvent $event) {
        $response = json_failure('Access Denied: invalid token', 401);
        $event->setResponse($response);
        $event->getResponse()->setStatusCode(401);
    }
}